﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace HefaSyncTool
{
    public partial class ValidationForm : HefaSyncTool.Controls.HefaForm
    {
       
        public ValidationForm()
        {
            InitializeComponent();
        }

        private void kryptonButton1_Click(object sender, EventArgs e)
        {   
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Code = this.kryptonTextBox1.Text;
            this.Close();
        }

        public Image CodeImage
        {
            set
            {
                this.pictureBox1.Image = value;
                CalucationSize(value.Size);
            }
        }

        private void CalucationSize(Size size)
        {
            this.Height = this.Height+ size.Height -this.pictureBox1.Height;
            this.Width = this.Width + size.Width - this.pictureBox1.Width; 
            this.pictureBox1.Size = size;
        }

        public string Code
        {
            get;
            set;
        }

        private void kryptonTextBox1_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                this.kryptonButton1.PerformClick();
            }
        }
    }
}
